<?php

$backend = dirname(__FILE__) . '/../../backend';
Yii::setPathOfAlias('backend', $backend);

return CMap::mergeArray(
    require(dirname(__FILE__) . '/../main.php'),
    array(
        'controllerPath' => $backend . '/controllers',
        'viewPath' => $backend . '/views',
        /*'runtimePath' => $backend.'/runtime',*/
        'layoutPath' => $backend . '/views/layouts',
        'defaultController' => 'backendsite',


        'import' => array(
            'backend.models.*',
            'backend.models.forms.*',
            'backend.models.tests.*',
            'backend.components.*',
            'application.models.*',
            'application.components.*',
            'application.common.*',
        ),

        'components' => array(
            'errorHandler' => array(
                // use 'site/error' action to display errors
                'errorAction' => 'backendsite/error',
            ),
            // User component
            'user' => array(
                'class' => 'WebUser',
                // enable cookie-based authentication
                //'allowAutoLogin'=>true,
                'loginUrl' => array('backendsite/login'),
                'cookieName' => 'backend__',
            ),

            // Yii AuthManager
            'authManager' => array(
                'class' => 'CDbAuthManager',
                'connectionID' => 'db',
                'itemTable' => 'admin_role',
                'itemChildTable' => 'admin_role_child',
                'assignmentTable' => 'admin_role_assignment',
                'defaultRoles' => array('guest'),
            ),

            /*'urlManager' => array(
                'baseUrl' => '',
                //'urlFormat'=>'path',
                'showScriptName' => true,
            ),*/

            'messages' => array(
                'basePath' => $backend . '/messages',
            ),

            // enables theme based JQueryUI's
            'widgetFactory' => array(
                'widgets' => array(
                    'CJuiAccordion' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiAutoComplete' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiButton' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiDatePicker' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiDialog' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiDraggable' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiDroppable' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiInputWidget' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiProgressBar' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiResizable' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiSelectable' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiSlider' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiSliderInput' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiSortable' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiTabs' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                    'CJuiWidget' => array(
                        'themeUrl' => '/css/backend',
                        'theme' => 'backend-theme',
                    ),
                ),
            ),
        ),
    )
);
